<?php
class ImageModel extends MACAbstractModel{
	
	public function __construct($table, $primary) {
		parent::__construct($table, $primary);
	}
	
	
	public function getImage($image_id)
	{
		$this->logger->info("ImageModel::getImage > image_id = $image_id");
		$result = array();
		
		$row = $this->fetchRow("image_id = '$image_id'");
	
		if(isset($row->image_content)){
			$result['content'] = $row->image_content;
			$result['type'] = $row->image_type;
			return $result;
		}
		else
			return null;
	}
	
	
	
	
	
	
	
	
	
	
	public static function getInstance($table, $primary) {
		if(is_null(self::$_instance)) self::$_instance = new ImageModel($table, $primary);
		if(self::$_instance->_name != $table) self::$_instance = new ImageModel($table,$primary);
		return self::$_instance;
	}
	
	public static function getDbTable()
	{
		if (null === $self::_dbTable) {
			$self::setDbTable('ImageModel');
		}
		return $self::_dbTable;
	}
	
}